<!-- 我的资料 -->
<style lang="less" scoped>
  .r-txt {
    text-align: right;
    width:65%;
  }
  .btn-large {
    border-radius: 0;
  }
  .vux-actionsheet{
    line-height: 30px;
  }
</style>


<template>
  <div class="contain supplier">
    <div class="lltab ft14">
      <tab bar-active-color="#77babd" defaultColor="#333333" active-color="#77babd" :line-width='2' v-model="tabNo">
        <tab-item @on-item-click="type = 1">经营资料</tab-item>
        <tab-item @on-item-click="type = 2">联系方式</tab-item>
        <tab-item @on-item-click="type = 3">企业证照</tab-item>
        <tab-item @on-item-click="type = 4">财务信息</tab-item>
      </tab>
    </div>

    <ul class="text-list" v-if="tabNo === 0">
      <li class="displayflex">
        <span class="l-txt flex1">公司名称</span>
        {{supInfo.chinesename}}
        <!-- <input class="r-txt" v-model="supInfo.chinesename"/> -->
      </li>
      <li class="displayflex">
        <span class="l-txt flex1">英文名称</span>
          {{supInfo.englishname}}
        <!-- <actionsheet v-model="showSex" :menus="SexMenu" @on-click-menu="SetSex" v-bind:show-cancel="false"></actionsheet> -->
      </li>
      <li class="displayflex">
        <span class="l-txt flex1">公司简称</span>
        {{supInfo.abbreviation}}
      </li>
      <li class="displayflex">
        <span class="l-txt flex1">注册地址</span>
        {{supInfo.province}}{{supInfo.city}}{{supInfo.district}}{{supInfo.address}}
      </li>
       <li class="displayflex">
        <span class="l-txt flex1">注册日期</span>
        {{supInfo.registereddate}}
      </li>
       <li class="displayflex">
        <span class="l-txt flex1">注册资本</span>
        {{supInfo.registeredcapital}}
      </li>
       <li class="displayflex">
        <span class="l-txt flex1">经营范围</span>
         {{supInfo.oorange}}
      </li>
         <li class="displayflex">
        <span class="l-txt flex1">法人</span>
         {{supInfo.personincharge}}
      </li>
          <li class="displayflex">
        <span class="l-txt flex1">法人身份证</span>
         {{supInfo.idcode}}
      </li>
    </ul>

    <ul class="text-list" v-if="tabNo === 1">
      <li class="displayflex">
        <span class="l-txt flex1">公司电话</span>{{supInfo.corptel}}
      </li>
      <li class="displayflex">
        <span class="l-txt flex1">联系人</span>{{supInfo.contacts}}
      </li>
      <li class="displayflex">
        <span class="l-txt flex1">联系电话</span>{{supInfo.contacttel}}
      </li>
      <li class="displayflex">
        <span class="l-txt flex1">传真</span>{{supInfo.corpfax}}
      </li>
       <li class="displayflex">
        <span class="l-txt flex1">电子邮箱</span>{{supInfo.email}}
      </li>
       <li class="displayflex">
        <span class="l-txt flex1">通讯地址</span>{{supInfo.address}}
      </li>
    </ul>

    <uploader :title="'企业证照'" :img-list="imgList" :max="max" v-if="tabNo === 2"></uploader>

    <ul class="text-list" v-if="tabNo === 3">
      <li class="displayflex">
        <span class="l-txt flex1">账户名称</span>{{supInfo.enterprisename}}
      </li>
      <li class="displayflex">
        <span class="l-txt flex1">收款银行</span>{{supInfo.bank}}
      </li>
      <li class="displayflex">
        <span class="l-txt flex1">收款账号</span>{{supInfo.bankaccount}}
      </li>
    </ul>



  </div>
</template>

<script>
import appHeader from '@/components/core/header/app_header.vue';
import uploader from '@/components/share/imageUploader/imageUploader.vue';
export default {
  components:{
    appHeader,
    uploader
  },
  data() {
    return {
      supInfo:[],
      imgList:[],

      picLoaded: false,
      type:1,
      tabNo:0,
      max:0,
    }
  },
  watch: {
    type(n,o){
      this.tabNo = this.type - 1;
      if(this.tabNo === 2 && this.picLoaded === false){
        this.getLic();
      }
    }
  },
  created(){
    document.title = '我的资料';
    this.type = 1
    this.getData();
  },
  computed:{
    userinfo(){
      return localStorage.getItem('userinfo') === null?null:JSON.parse(localStorage.getItem('userinfo'));
    }
  },
  methods: {
    getData() {
      this.Ajax.post('wxh/excsupplier/'+this.$route.query.Guid).then((resp) => {
        if (resp.errorCode==0) {
          this.supInfo = resp.data;
        } else {
          this.Toast({
            message: resp.message || '操作异常，请稍后重试',
          });
        };
      });
    },
    getLic(){
      this.Ajax.post(`/wxh/excsupplier/lic/${this.$route.query.Guid}`).then((res) => {
        if (res.errorCode == 0) {
          this.imgList = res.data;
          this.picLoaded = true;
        } else {
          this.Toast({
            message: resp.message || '操作异常，请稍后重试',
          });
        };
      });
    }
  }
}
</script>
